package demo_thread;

/**
 * @author: android 超级兵
 * @create: 2022-01-15 14:21
 * TODO Thread.join 的作用
 **/
public class ClientJoin {


    public static void main(String[] args) throws InterruptedException {

        // 另外一种场景
        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Thread 1");
            }
        });

        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Thread 2");
            }
        });

        Thread thread3 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Thread 3");
            }
        });

        thread3.start();
        thread3.join();

        thread1.start();
        thread1.join();

        thread2.start();
        thread2.join();

    }
}